package com.mmy.fta.usercenter.utils;

import java.util.Random;

/**
 * @author qingyu.meng
 * @date 2021年10月25日 3:57 下午
 * @Description
 */
public class ToolUtils {
    private static String firstName = "赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳鲍史唐费常乐于时傅皮卞齐康伍余元卜顾孟平黄和穆萧尹庞熊纪舒屈项祝董梁杜阮蓝闵席季麻强贾路娄危江童颜郭梅盛林刁钟徐邱骆高夏蔡田樊胡凌霍虞万支柯咎管卢莫经房裘缪干解应宗宣丁贲邓郁单杭洪包诸左石崔吉";
    private static String girl = "秀娟英华慧巧美娜静淑惠珠翠雅芝玉萍红娥玲芬芳燕彩春菊兰凤洁梅琳素云莲真环雪荣爱妹霞香月莺媛艳瑞凡佳嘉琼勤珍贞莉桂娣叶璧璐娅琦晶妍茜秋珊莎锦黛青倩婷姣婉娴瑾颖露瑶怡婵雁蓓纨仪荷丹蓉眉君琴蕊薇菁梦岚苑婕馨瑗琰韵融园艺咏卿聪澜纯毓悦昭冰爽琬茗羽希宁欣飘育滢馥筠柔竹霭凝晓欢霄枫芸菲寒伊亚宜可姬舒影荔枝思丽 ";
    private static String boy = "伟刚勇毅俊峰强军平保东文辉力明永健世广志义兴良海山仁波宁贵福生龙元全国胜学祥才发武新利清飞彬富顺信子杰涛昌成康星光天达安岩中茂进林有坚和彪博诚先敬震振壮会思群豪心邦承乐绍功松善厚庆磊民友裕河哲江超浩亮政谦亨奇固之轮翰朗伯宏言若鸣朋斌梁栋维启克伦翔旭鹏泽晨辰士以建家致树炎德行时泰盛雄琛钧冠策腾楠榕风航弘";
    public static String name_sex = "";

    private static int getNum(int start, int end) {
        return (int) (Math.random() * (end - start + 1) + start);
    }

    private static String cp(int num) {
        String Num = num + "";
        if (Num.length() == 1) {
            return "0" + Num;
        } else {
            return Num;
        }
    }


        /**
         * 随机生成18位身份证号
         * @return
         */
        public static String generateIdentityNum() {
            String code = "";
            Random random = new Random();
            for (int i = 0; i < 18; i++) {
                int r = random.nextInt(10); //每次随机出一个数字（0-9）
                code = code + r;  //把每次随机出的数字拼在一起
            }
            return code;
        }

        /**
         * 随机生成中文姓名
         * @return
         */
        public static String generateChineseName () {
            int index = getNum(0, firstName.length() - 1);
            String first = firstName.substring(index, index + 1);
            int sex = getNum(0, 1);
            String str = boy;
            int length = boy.length();
            if (sex == 0) {
                str = girl;
                length = girl.length();
                name_sex = "女";
            } else {
                name_sex = "男";
            }
            index = getNum(0, length - 1);
            String second = str.substring(index, index + 1);
            int hasThird = getNum(0, 1);
            String third = "";
            if (hasThird == 1) {
                index = getNum(0, length - 1);
                third = str.substring(index, index + 1);
            }
            return first + second + third;
        }

    /**
     * 随机生成日期
     * @return
     */
    public static String generateDate () {
            Random rndYear = new Random();
            int year = rndYear.nextInt(10) + 2021;  //生成[2000,2017]的整数；年
            Random rndMonth = new Random();
            int month = rndMonth.nextInt(12) + 1;   //生成[1,12]的整数；月
            Random rndDay = new Random();
            int Day = rndDay.nextInt(28) + 1;       //生成[1,30)的整数；日
            Random rndHour = new Random();
        /*int hour=rndHour.nextInt(23);       //生成[0,23)的整数；小时
        Random rndMinute=new Random();
        int minute=rndMinute.nextInt(60);   //生成分钟
        Random rndSecond=new Random();
        int second=rndSecond.nextInt(60);   //秒*/
            return year + "-" + cp(month) + "-" + cp(Day);
        }
    }
